home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-20
/
rs0422.zip
/
CONFIGUR
/
MEMSIZ.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-12-09
|
6KB
|
186 lines
/*
* Copyright 1988 by the Radio Amateur Telecommunications Society
* and Thomas A. Moulton, W2VY
*
* This software may only be modified, copied, distributed or
* executed for non-profit purposes by individuals operating
* systems in the Amateur Radio Service. Credit to the
* author(s) and to the Radio Amateur Telecommunications Society
* must be made in modules where RATS provided software is used,
* and in any announcements and documentation.
*
* As a non-profit, research and development organization, the
* Radio Amateur Telecommunications Society distributes software
* in both executable and source forms. This policy is in place
* to encourage the development and distribution of OSI-based,
* networking tools. In order to protect the interests of the
* Society and the authors, we have placed some conditions
* of use on the software. Other groups are encouraged
* to place the same or similar guidelines on
* software they produce.
*
* The Radio Amateur Telecommunications Society reserves the right
* to specify and alter the terms under which software provided by
* the Society may be used. This policy is consistent with the
* objective of uniform and consistent "Open Systems Interconnections."
*
* All acceptable Amateur Radio related uses of this software
* will be outlined in the "ROSE Implementer's Guide". Individuals
* or organizations wishing to add to, or modify the provisions of
* the guide to accommodate local or evolutionary requirements
* should document the proposed change(s) and forward them to the
* Society. If accepted, written notification will be provided by
* the Society to the submitting organization or individual(s).
* The Society will then issue a "ROSE Implementer's Guide Change
* Notice". Periodically, the Society will re-issue the "ROSE
* Implementer's Guide" and incorporate the text of the change
* notices. This procedure has been put in to place to ensure
* compatibility between systems and to ensure their "Openness"
* and interoperability.
*
* No part of this software may be used in other packages
* without prior authorization from the author or the Society.
* Software incorporating this module, all or in part, must be
* provided to the Society prior to distribution or use by
* anyone not directly involved in testing of the revised
* environment. Current releases of the combined software must
* be provided to the Society in both source and executable
* forms. Adequate documention to produce an executable module
* from the provided source must also be included.
*
* Non-Amateur Radio non-profit uses may be authorized on a case
* by case basis. Inquiries for such use may be made in writing
* to the Society. Non-commercial uses consistent with the
* general principles of Open Systems Interconnection Reference
* Model will be generally considered with favor.
*
* Commercial licensing of the software is also available based
* on normal commercial terms. Licensing inquiries should be
* directed to the Society. Commercial licensing of the standard
* software will be done in situations which materially benefit
* the Amateur Radio Packet Network. Additional licensing is
* reserved by the individual authors.
*
* The Radio Amateur Telecommunications Society provides this software
* on an "as is" basis. The Society assumes no liability for
* loss incurred through the use of this software. Amateur Radio
* use of this software implies non-commercial and voluntary
* development, deployment and use of this software in a "Amateur",
* non-commercial service. Commercial users are encouraged to
* inspect their copies of the source code. Source code modification
* licenses are available if a combined Object and Source Code
* license was not originally established.
*
* The Society may be contacted by writing or calling at:
*
* The Radio Amateur Telecommunications Society
* 206 North Vivyen Street.
* Bergenfield, New Jersey 07621
*
* Telephone: 201-387-8896
*
*/
#include "data.h"
#include "buffer.h"
#include "iface.h"
#include "timer.h"
#include "ax25.h"
#include "ax25l2.h"
#include "l3struc.h"
#include "x25cause.h"
#include "l3calls.h"
#include "tx.h"
#include "config.h"
#include "upfcn.h"
int NULLFCN(), clr_config(), con_config(), recv_boot();
int send_config(), rst_boot(), unload_ok();
struct upfcn config={
{{0x9a, 0x8a, 0x9a, 0xa6, 0x92, 0xb4}, {0x00}}, /* MEMSIZ-0 */
rst_boot, clr_config, con_config, recv_boot,
send_config, NULLFCN, unload_ok,
"MEMSIZ - ROSE Memory Utilization Display\r"
};
extern unsigned int MEMSIZ, HEAPUSD;
extern struct datastr *l2_user_info, l2_info;
struct datastr *mkpkt();
char cnf_busy;
struct datastr *cnf_in;
putdec(bp, val, w)
struct datastr *bp;
unsigned int val;
int w;
{
static char z[10];
static unsigned int v, u10;
static int i;
u10 = 10;
for (i=0;i<10;i++) z[i]=' ';
z[9]=0;
v=val;
for (i=8;i>=0, v!=0;i--) /* Stuff one digit at a time */ {
z[i] = '0' + (v - (v/u10)*u10);
v = v / 10;
}
bappstr(bp, &z[9-w]);
}
int
con_config(vc)
register struct VCS *vc;
{
static int (*fn)();
extern struct datastr *frag_pkt();
vc=vc->peer;
if (!vc) return;
fn=vc->SEND;
puthex2("con",vc,"at",fn);
(*fn)(vc,info_pkt());
if (cnf_busy) {
(*fn)(vc,mkpkt("Busy\r"));
set_p(vc,P6,Number_Busy);
}
else {
cnf_busy=TRUE;
}
}
int
clr_config(vc,c)
struct VCS *vc;
int c;
{
cnf_busy=FALSE;
set_p(vc, P1, 0);
}
int
send_config(vc, pkt)
register struct VCS *vc;
struct datastr *pkt;
{
static int i, ch;
puthex2("send fig",vc,"",pkt);
vc_queue_data(vc,pkt);
while ((cnf_in = vc->tx_queue)) /* There is stuff waiting */ {
vc->tx_queue = cnf_in->next;
free_buffer(cnf_in);
cnf_in=mkpkt("\rMemory Size is: ");
putdec(cnf_in, MEMSIZ, 7);
bappstr(cnf_in," Bytes\rMemory Used is: ");
putdec(cnf_in, HEAPUSD, 7);
bappstr(cnf_in, " Bytes\r");
(*vc->peer->SEND)(vc->peer, cnf_in);
}
return 256; /* We are never busy! */
}